import request from "@/utils/request";
import {order} from "mockjs/src/mock/random/helper";


/**
 * 获取站点未处理的订单数量
 * @returns {Promise<unknown>}
 */
export function getSellerOrderNum(params = {}){
  return request({
    url: '/order/getSellerOrderNum',
    method: 'get',
    params,
  })
}

/**
 * 获取订单的列表数据
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getOrderList(params = {}){
  return request({
    url: '/order/getOrderList',
    method: 'get',
    params,
  })
}

export function getOrder(orderId){
  return request({
    url: `/order/${orderId}`,
    method: 'get',
  })
}

/**
 * 传快递单
 * @param data
 * @returns {Promise<unknown>}
 */
export function deliveryOrder(data){
  return request({
    url: '/order/deliveryOrder',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 使用库存
 * @param data
 * @returns {Promise<unknown>}
 */
export function stockOrder(data){
  return request({
    url: '/order/stockOrder',
    method: 'post',
    data,
    handleError: true,
  })
}


/**
 * 忽略订单
 * @param data
 * @returns {Promise<unknown>}
 */
export function ignoreOrder(data){
  return request({
    url: '/order/ignoreOrder',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 重新提醒订单
 * @param orderId
 * @returns {Promise | Promise<unknown>}
 */
export function forgetIgnore(orderId){
  return request({
    url: `/order/forgetIgnore/${orderId}`,
    method: 'get',
  })
}

/**
 * 删除订单
 * @param orderId
 * @returns {Promise | Promise<unknown>}
 */
export function deleteStickerOrder(orderId){
  return request({
    url: `/order/deleteStickerOrder/${orderId}`,
    method: 'delete',
  })
}


/**
 * 修改快递单
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export function editDelivery(data){
  return request({
    url: `/order/editDelivery/${data.orderId}`,
    method: 'patch',
    data,
  })
}

/**
 * 获取所有的快递公司
 * @returns {Promise | Promise<unknown>}
 */
export function getExpressList(){
  return request({
    url: '/express/getExpressList',
  })
}

/**
 * 获取订单的聚合模块数据
 * @param params
 * @returns {Promise<unknown>}
 */
export function getOrderGoodsNum(params){
  return request({
    url: '/order/getOrderGoodsNum',
    params
  })
}


/**
 * 使用库存
 * @param data
 * @returns {Promise<unknown>}
 */
export function order1688(data){
  return request({
    url: '/order/order1688',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 修改1688订单
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export function editOrder1688(data){
  return request({
    url: `/order/editOrder1688/${data.orderId}`,
    method: 'patch',
    data,
  })
}

/**
 * 获取店铺的订单数量情况
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getAccountOrderNumList(params){
  return request({
    url: `/order/getAccountOrderNumList`,
    method: 'get',
    params
  })
}

/**
 * 变更订单的相关信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export function changeOrderData(data){
  return request({
    url: '/order/changeOrderData',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 变更包装服务类型
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export function changePackageType(data){
  return request({
    url: '/order/changePackageType',
    method: 'post',
    data,
    handleError: true,
  })
}
